<?php
$webRoot=dirname(__FILE__);
// change the following paths if necessary
$yii=$webRoot.'/../framework/yii.php';

require_once( $webRoot . '/protected/extensions/phaAuthor/EPhaAuthor.php');

$sAuthor = EPhaAuthor::get();

if ( $sAuthor !== false ) {
    // turn on debug mode + author config
    $config = $webRoot.'/protected/config/' . $sAuthor . '.php';
    if (!file_exists($config)) {
        $config = $webRoot . '/protected/config/main.php';
    }
    defined('YII_DEBUG') or define('YII_DEBUG',true);

    // specify how many levels of call stack should be shown in each log message
    defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
}
else {
    // production mode
    $config=$webRoot . '/protected/config/production.php';
}

require_once($yii);
Yii::createWebApplication($config)->run();
